

$(function () {
	
	//设置活动时间
	var start = $("#actTimeStart").val();
	var end = $("#actTimeEnd").val();
	$("#daterange3_edit").html(start+" 至  "+end);
	
    //兑奖时间
	//var win = getFormatDateByLong($("#cashTimeEnd").val(),"yyyy-MM-dd hh:mm:ss");
	var win = $("#cashTimeEnd").val();
    $("#config-demo-edit").html(win);
    
    
    //抽奖背景图
    //$("#backgroundImage1").empty();
    var image1 = $("#backgroundImage1").val();
    if (image1) {
        var pictures = image1.split(",");
        for (var i in pictures) {
            var uri = pictures[i];
            if (/.+/.test(uri)) {
                var $imgEle = $("<img src='" + PicDomain + uri + "' data-picuri='" + uri + "'/>");
                /*$imgEle.click(function () {
                    $(this).remove();
                });*/
                $("#ctn_edit_product_pics").append($imgEle);
            }
        }
    }
	//中奖背景图
   // $("#backgroundImageWin").empty();
    var image_win = $("#backgroundImageWin").val();
    if (image_win) {
    	var pictures = image_win.split(",");
    	for (var i in pictures) {
    		var uri = pictures[i];
    		if (/.+/.test(uri)) {
    			var $imgEle = $("<img src='" + PicDomain + uri + "' data-picuri='" + uri + "'/>");
    			/*$imgEle.click(function () {
    				$(this).remove();
    			});*/
    			$("#ctn_edit_product_pics_win").append($imgEle);
    		}
    	}
    }
  //未中奖背景图
    var image_nowin = $("#backgroundImageLos").val();
    if (image_nowin) {
    	var pictures = image_nowin.split(",");
    	for (var i in pictures) {
    		var uri = pictures[i];
    		if (/.+/.test(uri)) {
    			var $imgEle = $("<img src='" + PicDomain + uri + "' data-picuri='" + uri + "'/>");
    			/*$imgEle.click(function () {
    				$(this).remove();
    			});*/
    			$("#ctn_edit_product_pics_nowin").append($imgEle);
    		}
    	}
    }
    
  //自动抽奖操作
    var temp = $("#isAutoDraw_hidden").val();
    if(temp == 1){
    	$("#get_div").hide();
    }else{
    	$("#get_div").show();
    }
  
    
    

    
});





//===================以下为公共方法============================


 
 /**   
 *转换long值为日期字符串   
 * @param l long值   
 * @param pattern 格式字符串,例如：yyyy-MM-dd hh:mm:ss   
 * @return 符合要求的日期字符串   
 */    

 function getFormatDateByLong(l, pattern) {  
     return getFormatDate(new Date(l), pattern);  
 }
 /**   
  *转换日期对象为日期字符串   
  * @param l long值   
  * @param pattern 格式字符串,例如：yyyy-MM-dd hh:mm:ss   
  * @return 符合要求的日期字符串   
  */    
  function getFormatDate(date, pattern) {  
      if (date == undefined) {  
          date = new Date();  
      }  
      if (pattern == undefined) {  
          pattern = "yyyy-MM-dd hh:mm:ss";  
      }  
      return date.format(pattern);  
  }
//扩展Date的format方法   
  Date.prototype.format = function (format) {  
      var o = {  
          "M+": this.getMonth() + 1,  
          "d+": this.getDate(),  
          "h+": this.getHours(),  
          "m+": this.getMinutes(),  
          "s+": this.getSeconds(),  
          "q+": Math.floor((this.getMonth() + 3) / 3),  
          "S": this.getMilliseconds()  
      }  
      if (/(y+)/.test(format)) {  
          format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
      }  
      for (var k in o) {  
          if (new RegExp("(" + k + ")").test(format)) {  
              format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
          }  
      }  
      return format;  
  } 
